package base;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import pages.MinePage;

public class BaseTest1 {
	String urlStr = "http://127.0.0.1:4723/wd/hub";
	public  AndroidDriver<AndroidElement>  driver=null;
	@BeforeClass
	public void initDirver() throws MalformedURLException, InterruptedException {
		DesiredCapabilities cap = new DesiredCapabilities();
		cap.setCapability("platformName", "Android");
		cap.setCapability("deviceName", "127.0.0.1:62001");
		cap.setCapability("appPackage", "com.lyc.cashbook");
		cap.setCapability("appActivity",".ui.LoginActivity");
		
//		cap.setCapability("noReset", false);
		URL url = new URL(urlStr);
		driver = new AndroidDriver<AndroidElement>(url, cap);
		
		MinePage minePage=new MinePage(driver);
		minePage.register("lhc","123","123");
		minePage.login("lhc", "123");
	}
	@AfterClass
	public void quitApp() {
		if(driver!=null) {
			driver.quit();
		}
		
	}
}
